/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Ressources;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

/**
 *
 * @author alocubiche
 */
public class Serialize {
    
    public static void set(Object o) throws IOException {
        FileOutputStream out = new FileOutputStream("save1.ser");
        ObjectOutputStream oos = new ObjectOutputStream(out);
        oos.writeObject(o);
        oos.flush();
        oos.close();

    }

    public static Object get() throws FileNotFoundException, IOException, ClassNotFoundException {
        FileInputStream in = new FileInputStream("save1.ser");
        ObjectInputStream ois = new ObjectInputStream(in);
        Object o = ois.readObject();
        ois.close();
        return o;
    }
}
